import os
def callback(fileExtList, directory, files):
    #for file in files:
    #    print os.path.join(directory, file)

    fileList = [os.path.join(directory, f) for f in files \
                if os.path.splitext(f)[1] in fileExtList]
    for f in fileList: print f
    
if __name__ == "__main__":
    print os.path.walk("/home/orange/python/pythonbook/", callback, ['.py'])        